{% extends "personal_center/base.html" %}

{% block page_link %}
    <script src="../../static/technological/js/sponsor.js"></script>
    <link rel="stylesheet" href="../../static/technological/css/style.css">
    <link href='../../static/public_file/fullcalendar/core/main.css' rel='stylesheet'/>
    <link href='../../static/public_file/fullcalendar/daygrid/main.css' rel='stylesheet'/>
    <link href='../../static/public_file/fullcalendar/timegrid/main.css' rel='stylesheet'/>
    <link href='../../static/public_file/fullcalendar/list/main.css' rel='stylesheet'/>
    <link rel="stylesheet" href="../../static/public_file/css/flatpickr.min.css">

    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/index.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/common.css">
    <script type="text/javascript" src="../../static/personal_center/js/index.js"></script>
    <link rel="stylesheet" href="../../static/public_file/css/PersonnelChooser.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }

        .add_background {
            background: #A9A9A9;
        }

        .li-class {
            list-style: none;
            margin-top: 2%;
            color: #0b0b0b;
            cursor: pointer;
        }

        li {
            list-style: none;
            color: #454d55;
        }

        .add-cars li:hover {
            background-color: #cccccc;
        }

        tr {
            height: 35px;
        }

        th {
            text-align: center;
        }

        #huiyi_table tr:hover{
            background: #cfcfcf;
        }

        .calendar {
            width: 30%;
            display: inline-block;
            vertical-align: top;
        }

        #calendar_title {
            font-size: 0;
            margin: 0;
            padding: 0;
            text-align: center;
        }

        #calendar_title li {
            list-style: none;
            width: 14%;
            display: inline-block;
            vertical-align: top;
            text-align: center;
            font-size: 14px;
        }

        #date li {
            list-style: none;
            width: 14%;
            display: inline-block;
            vertical-align: top;
            text-align: center;
            font-size: 14px;
            cursor: pointer;
            border-radius: 50%;
        }

        #date li:hover {
            background: #1E90FF;
            color: #efefef;
        }

        #prev {
            cursor: pointer;
        }

        #next {
            cursor: pointer;
        }

        .same_month {
            color: #454d55;
        }

        .active {
            background: #1E90FF;
            color: #efefef;
        }

        .ul_class {
            margin: 0;
            font-size: 0;
            padding: 0
        }

        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }

        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }

        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }

        #ThreeNavigation div {
            padding-left: 2%;
        }

    </style>
{% endblock %}



{% block right_content %}
    <div id="new_models1" class="shade">
        <div id="new_models" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 700px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box"
                     style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 3px;border-top-right-radius: 3px;">
                    <h5 id="modal-title" class="modal-title"
                        style="line-height: 50px;width: 15%;margin-left: 1%;display: inline-block;">预定会议室</h5>
                    <span onclick="close_models()"
                          style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i
                            class="iconfont icon-quchu"></i></span>
                </div>
                <hr>
                <div style="width: 100%;padding-top: 2%;padding-left: 2%;">
                    <div>
                        <label for=""><span style="color: red;">* </span><p style="display: inline-block;letter-spacing: 2.3px;">申&nbsp;请&nbsp;人</p></label>
                        <input id="names" type="text" placeholder="{{ realname }}" value="{{ realname }}"
                               style="width: 500px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;margin-left: 5px;"
                               disabled>
                    </div>
                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;">* </span>申请科室</label>
                        <input id="department" type="text" placeholder="{{ department }}" value="{{ department }}"
                               style="width: 500px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;margin-left: 5px;"
                               disabled>
                    </div>

                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;">* </span>事&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;由</label>
                        <input id="particulars" type="text"
                               style="width: 500px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;margin-left: 5px;"
                               onfocus="add_color(this.id)" onblur="del_color(this.id)">
                    </div>

                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;">* </span>使用时间</label>
                        <input style="border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;width: 240px;margin-left: 5px;" class="input-style" type="text" name="car_start" id="time_start"
                               placeholder="请选择开始日期" autocomplete="off"> ～ <input style="width: 240px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;"
                            class="input-style" type="text" name="car_end" id="time_end" placeholder="请选择结束日期" autocomplete="off">
                    </div>

                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;">* </span><p style="display: inline-block;letter-spacing: 2.3px;">会&nbsp;议&nbsp;室</p></label>
                        <select name="" id="meeting_root"
                                style="width: 500px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;margin-left: 5px;">
                            <option value="行政楼七楼大会议室">行政楼七楼大会议室</option>
                            <option value="内科楼十楼会议室">内科楼十楼会议室</option>
                            <option value="党员活动室">党员活动室</option>
                            <option value="小会议室">小会议室</option>
                        </select>
                    </div>

                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;">* </span>参会人数</label>
                        <input id="Number_people" type="text"
                               style="width: 500px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;margin-left: 5px;"
                               onfocus="add_color(this.id)" onblur="del_color(this.id)">
                    </div>

                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;visibility: hidden;">* </span>参会人员</label>
                        <input ondblclick="model_line()" type="text" id="conferee" style="width: 500px;border-radius: 3px;border: #dfdfdf solid 1px;height: 35px;padding-right: 1px;margin-left: 5px;" placeholder="双击选择参会人员，单击输入参会人员" onfocus="add_color(this.id)" onblur="del_color(this.id)" autocomplete="off">
                    </div>

                    <div style="margin-top: 2%;">
                        <label for=""><span style="color: red;">* </span><p style="display: inline-block;letter-spacing: 2.3px;">签&nbsp;到&nbsp;码</p></label>
                        <input type="checkbox" id="sign_in_code_1" class="sign_in_code" onclick="SignInCode(1)" value="1" style="margin-left: 5px;"> 是
                        <input type="checkbox" id="sign_in_code_2" class="sign_in_code" onclick="SignInCode(2)" value="0"> 否
                    </div>

                    <div id="PersonnelList" style="margin-top: 2%;display: none;">
                        <label for="" style="margin-top: 3px;"><span style="color: red;">* </span><p style="display: inline-block;letter-spacing: 2.3px;">人员名单</p></label>
                        <a href="javascript:;" class="file" style="vertical-align: top;">
                            上传文件
                            <input type="file" name="party_main_body" id="party_main_body" onchange="UploadPersonnelList()">
                        </a>

                        <button style="border: #0c6fd9 solid 1px;background: #0c6fd9;border-radius: 3px;outline: none;margin-left: 20px;"><a href="../../static/model_file/会议室参会名单模板.xlsx" style="color: white;">下载模板</a></button>
                        <span id="file_names"></span>
                    </div>

                    <div style="margin-left: 2%;width: 96%;height: 150px;">
                        <div style="width: 150px;height: 150px;display: inline-block;vertical-align: top;">
                            <a href="javascript:;" class="file" style="margin-top: 25px;">
                                <img src="../../static/personal_center/img/加号_o.png" alt="" onclick="onclick_upload_file()" style="width: 100px;height: 100px;vertical-align: baseline;">
                                <input type="file" name="regular_main_body" id="regular_main_body" onchange="upload_accessory1('file2', 'regular_main', 'regular_main_body')">
                            </a>
                        </div>

                        <div id="upload_file_list" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;">

                        </div>
                    </div>
                </div>
                <hr>
                <div style="width: 100%;height: 40px;text-align: right;padding-right: 2%;">
                    <button onclick="summitData()"
                            style="width: 100px;height: 30px;border: #dfdfdf solid 1px;margin-top: 5px;border-radius: 3px;background: #1E90FF;color: white;">
                        提交
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div id="meeting_apple" style="width: 100%;height: 99%;overflow: auto;margin-top: 0.5%;">
        <div style="width: 20%;height: 99%;background-color: white;display: inline-block;margin-left: 0.5%;">
            <div style="width: 100%;height: 45px;border-bottom: #cccccc solid 1px;line-height: 45px;padding-left: 2%;color: black;vertical-align: top;">
                <i class="iconfont icon-tixing" style="color: #1E90FF;"></i> 会议提醒
            </div>
            <div style="width: 100%;height: 45%;overflow: auto;">
                <div id="meeting_reminder" style="width: 100%;height: 100%;overflow: auto;">
                    <div style="margin-top: 6%;margin-left: 10%;">
                        <p>会议事由</p>
                        <div style="color: #1E90FF;">{{ particulars }}</div>
                    </div>

                    <div style="margin-top: 5%;margin-left: 10%;">
                        <div style="display: inline-block;">
                            <p>组织人</p>
                            <div style="color: #1E90FF;">{{ meeting_prople }}</div>
                        </div>

                        <div style="margin-left: 20%;display: inline-block;">
                            <p>会议地点</p>
                            <div style="color: #1E90FF;">{{ meeting_adress }}</div>
                        </div>
                    </div>

                    <div style="margin-top: 5%;margin-left: 10%;">
                        <p>会议时间</p>
                        <div style="color: #1E90FF;">
                            <p>{{ meeting_time_day }}</p>
                            <p><span>{{ meeting_time_start }}</span><span> ~ </span><span>{{ meeting_time_end }}</span></p>
                        </div>
                    </div>

                    <div style="margin-top: 5%;margin-left: 10%;">
                        <p>参会人员</p>
                        <div id="attendee" style="color: #1E90FF;">

                        </div>
                    </div>
                </div>
                <div id="no_meeting" style="width: 100%;height: 90%;display: none;">
                    <div style="width: 100%;text-align: center;padding-top: 100px;"><img
                            src="../../static/personal_center/img/查找.png" alt=""></div>
                    <div style="width: 100%;text-align: center;">没有需要参加的会议</div>
                </div>
            </div>
            <hr>
            <div style="width: 100%;height: 45px;border-bottom: #cccccc solid 1px;line-height: 45px;padding-left: 2%;color: black;vertical-align: top;border-top: #cccccc solid 1px;">
                <i class="iconfont icon-bianhaopeizhi" style="color: #1E90FF;"></i> 会议日历
            </div>
            <div style="width: 100%;height: 40%;overflow: auto;">
                <div id="" style="width: 100%;height: 90%;overflow: auto;">
                    <div style="text-align: center;height: 50px;line-height: 50px;">
                        <div id="prev" class="calendar">上一月</div>
                        <div class="calendar"><span id="nian"></span>年<span id="yue"></span></div>
                        <div id="next" class="calendar">下一月</div>
                    </div>
                    <div id="calendar_title">
                        <ul style="background: #cfcfcf;margin: 0;font-size: 0;padding: 0">
                            <li style="height: 35px;line-height: 35px;">日</li>
                            <li style="height: 35px;line-height: 35px;">一</li>
                            <li style="height: 35px;line-height: 35px;">二</li>
                            <li style="height: 35px;line-height: 35px;">三</li>
                            <li style="height: 35px;line-height: 35px;">四</li>
                            <li style="height: 35px;line-height: 35px;">五</li>
                            <li style="height: 35px;line-height: 35px;">六</li>
                        </ul>
                    </div>

                    <div id="date" style="padding-top: 2%;height: 55%;">
                    </div>
                </div>
            </div>
        </div>

        <div style="width: 78%;height: 99%;background-color: white;display: inline-block;margin-left: 0.5%;vertical-align: top;">
            <div style="width: 100%;height: 45px;border-bottom: #cccccc solid 1px;line-height: 45px;padding-left: 2%;color: black;">
                <div style="float: left;"><i class="iconfont icon-yulan1" style="color: #1E90FF;"></i> &nbsp;会议预览</div>
                <div style="float: left;padding-left: 100px;">
                    <div style="width: 15px;height: 15px;background: #808080;display: inline-block;vertical-align: center;"></div><span> 未开始</span>
                    <div style="width: 15px;height: 15px;background: #3CB371;display: inline-block;vertical-align: center;margin-left: 10px;"></div><span> 进行中</span>
                    <div style="width: 15px;height: 15px;background: #87CEEB;display: inline-block;vertical-align: center;margin-left: 10px;"></div><span> 已结束</span>
                </div>
                <div style="float: right;padding-right: 1.5%;">
                    <button onclick="online_tag()"
                            style="width: 100px;height: 35px;margin-top: 5px;border: #dfdfdf solid 1px;border-radius: 3px;line-height: 35px;background-color: #1E90FF;">
                        <a style="color: white;" href="#">会议室预定</a>
                    </button>
                </div>
            </div>
            <div style="width: 100%;height: 91%;overflow: auto;">
                <table class="table table-bordered" style="width: 100%;" id="t_tabless">
                    <thead>
                        <tr>
                            <th style="width: 8%;">时间段</th>
                            <th style="width: 23%;">行政楼七楼大会议室</th>
                            <th style="width: 23%;">小会议室</th>
                            <th style="width: 23%;">党员活动室</th>
                            <th style="width: 23%;">内科楼十楼会议室</th>
                        </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="t_table1">
                        {% for obj in room_data %}
                            <tr style="height: 42px;width: 100%;">
                                <td style="text-align: center;width: 12%;">{{ obj.data.time_duan }}</td>
                                {% if 'merge_0' in obj.data %}
                                    {% if obj.data.merge_0 != 0 %}
                                        {% if obj.data.status_0 == '0' %}
                                            <td style="padding-left: 10px;background: #808080;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_0 }}">{% autoescape off %}{{ obj.data.content_0 }}{% endautoescape %}</td>
                                        {% elif obj.data.status_0 == '1' %}
                                            <td style="padding-left: 10px;background: #3CB371;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_0 }}">{% autoescape off %}{{ obj.data.content_0 }}{% endautoescape %}</td>
                                        {% else %}
                                            <td style="padding-left: 10px;background: #87CEEB;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_0 }}">{% autoescape off %}{{ obj.data.content_0 }}{% endautoescape %}</td>
                                        {% endif %}
                                    {% else %}
                                        <td style="text-align: center;width: 22%;"></td>
                                    {% endif %}
                                {% endif %}

                                {% if 'merge_1' in obj.data %}
                                    {% if obj.data.merge_1 != 0 %}
                                        {% if obj.data.status_1 == '0' %}
                                            <td style="padding-left: 10px;background: #808080;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_1 }}">{% autoescape off %}{{ obj.data.content_1 }}{% endautoescape %}</td>
                                        {% elif obj.data.status_1 == '1' %}
                                            <td style="padding-left: 10px;background: #3CB371;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_1 }}">{% autoescape off %}{{ obj.data.content_1 }}{% endautoescape %}</td>
                                        {% else %}
                                            <td style="padding-left: 10px;background: #87CEEB;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_1 }}">{% autoescape off %}{{ obj.data.content_1 }}{% endautoescape %}</td>
                                        {% endif %}
                                    {% else %}
                                        <td style="text-align: center;width: 22%;"></td>
                                    {% endif %}
                                {% endif %}

                                {% if 'merge_2' in obj.data %}
                                    {% if obj.data.merge_2 != 0 %}
                                        {% if obj.data.status_2 == '0' %}
                                            <td style="padding-left: 10px;background: #808080;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_2 }}">{% autoescape off %}{{ obj.data.content_2 }}{% endautoescape %}</td>
                                        {% elif obj.data.status_2 == '1' %}
                                            <td style="padding-left: 10px;background: #3CB371;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_2 }}">{% autoescape off %}{{ obj.data.content_2 }}{% endautoescape %}</td>
                                        {% else %}
                                            <td style="padding-left: 10px;background: #87CEEB;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_2 }}">{% autoescape off %}{{ obj.data.content_2 }}{% endautoescape %}</td>
                                        {% endif %}
                                    {% else %}
                                        <td style="text-align: center;width: 22%;"></td>
                                    {% endif %}
                                {% endif %}

                                {% if 'merge_3' in obj.data %}
                                    {% if obj.data.merge_3 != 0 %}
                                        {% if obj.data.status_3 == '0' %}
                                            <td style="padding-left: 10px;background: #808080;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_3 }}">{% autoescape off %}{{ obj.data.content_3 }}{% endautoescape %}</td>
                                        {% elif obj.data.status_3 == '1' %}
                                            <td style="padding-left: 10px;background: #3CB371;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_3 }}">{% autoescape off %}{{ obj.data.content_3 }}{% endautoescape %}</td>
                                        {% else %}
                                            <td style="padding-left: 10px;background: #87CEEB;color: #F5F5F5;width: 22%;" rowspan="{{ obj.data.merge_3 }}">{% autoescape off %}{{ obj.data.content_3 }}{% endautoescape %}</td>
                                        {% endif %}
                                    {% else %}
                                        <td style="text-align: center;width: 22%;"></td>
                                    {% endif %}
                                {% endif %}
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div id="staff-select" class="shade">
        <div id="staff-model" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 900px;height: 500px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="staff-box" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 20%;margin-left: 1%;display: inline-block;line-height: 40px;font-size: 14px;">
                        选择人员
                    </div>
                    <span onclick="close_model()" style="float: right;padding-right: 2%;cursor: pointer;line-height: 37px;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 460px;width: 100%;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 70px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div id="dep" class="navigation navigation_color" onclick="change_navigation(this)">部门</div>
                        <div id="limits" class="navigation" onclick="change_navigation(this)">权限</div>
                        <div id="fun" class="navigation" onclick="change_navigation(this)">职能</div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;">
                            <input id="SearchDep" onkeydown="SearchDepartment()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 95%;">
                        </div>
                        <div id="SecondaryNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                            <input type="checkbox" id="select-all" onclick="SelectAll(this)">
                            <input id="SearchPeo" onkeydown="SearchProple()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 87%;">
                        </div>
                        <div id="ThreeNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 410px;height: 100%;display: inline-block;vertical-align: top;overflow: auto">
                        <div style="width: 100%;height: 40px;text-align: left;font-size: 14px;line-height: 40px;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;已选 <span id="selected-number">0</span> 人
                        </div>
                        <div id="selected-div" style="width: 100%;font-size: 14px;height: 370px;overflow: auto;line-height: 20px;">

                        </div>
                        <div style="width: 100%;font-size: 14px;height: 40px;text-align: center;">
                            <button onclick="IdentifyPersonnel()" style="width: 100px;height: 30px;line-height: 25px;text-align: center;letter-spacing: 5px;border-radius: 3px;border: #cfcfcf solid 1px;font-size: 14px;cursor: pointer;margin-top: 10px;">完成</button>
                            <button onclick="close_model()" style="margin-left: 15px;width: 100px;height: 30px;line-height: 25px;text-align: center;color: #0abb78;letter-spacing: 5px;border-radius: 3px;font-size: 14px;border: #cfcfcf solid 1px;cursor: pointer;margin-top: 10px;">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}


{% block script %}
    <script type="text/javascript" src="../../static/personal_center/js/other/jquery.js"></script>
    <script src="../../static/administrative/layDate-v5.0.9/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script type="text/javascript" src="../../static/public_file/js/PersonnelChoosersNew.js" charset="gb2312"></script>
    <script>
        {% if apply == 'apply' %}
            switchover('apply')
        {% endif %}
        function online_tag() {
            document.getElementById("new_models1").style.display = "table-row";
        }

        var uuid = "{{ uuid | safe }}";

        var local_insert = window.location.href.split("insert")
        if(local_insert.length === 2){
            document.getElementById("apply").click();
        }

        let title = document.querySelector("#box");
        let addForm = document.querySelector("#new_models");

        title.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm.offsetLeft;
            let y = e.pageY - addForm.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm.style.left = e.pageX - x + 'px';
                addForm.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function close_models() {
            document.getElementById("new_models1").style.display = "none";
        }

        function add_color(obj_id) {
            document.getElementById(obj_id).style.border = "solid 1px #0c6fd9"
        }

        function del_color(obj_id) {
            document.getElementById(obj_id).style.border = "solid 1px #efefef"
        }

        lay('#version').html('-v' + laydate.v);

        //执行一个laydate实例
        laydate.render({
            elem: '#time_start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#time_end' //指定元素
        });


        // 删除列表
        function deltr1() {
            var tb = document.getElementById('t_table2');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        function CompareDate(d1, d2) {
            return ((new Date(d1.replace(/-/g, "\/"))) > (new Date(d2.replace(/-/g, "\/"))));
        }

        function summitData() {
            var administrative_table = document.getElementById('upload_file_list');
            if (!administrative_table.children.length) {
                alert("请上传会议文件！");
                return false
            }
            var SignInCode = document.getElementsByClassName('sign_in_code');
            var sign_in_code = "";var PersonnelList = ""
            for (var jjj=0; jjj<SignInCode.length; jjj++) {
                if (SignInCode[jjj].checked) {
                    sign_in_code = SignInCode[jjj].value;
                }
            }
            if (!sign_in_code) {
                alert("请选择是否生成签到码！");
                return false
            }
            if (sign_in_code === "1") {
                if (!document.getElementById("file_names").innerText) {
                    alert("请下载参会人员名单模板并上传应参会人员！");
                    return false
                }
                PersonnelList = document.getElementById("party_main_body").files[0];
            }
            var form = new FormData();
            form.append("names", document.getElementById("names").value);
            form.append("department", document.getElementById("department").value);
            form.append("particulars", document.getElementById("particulars").value);
            form.append("time_start", document.getElementById("time_start").value);
            form.append("time_end", document.getElementById("time_end").value);
            form.append("meeting_root", $('#meeting_root option:selected').val());
            form.append("Number_people", document.getElementById("Number_people").value);
            form.append("conferee", document.getElementById("conferee").value);
            form.append("PersonnelList", PersonnelList);
            form.append("uuid", uuid);
            form.append("SignInCode", sign_in_code);
            var return_flag = CompareDate(document.getElementById("time_end").value, document.getElementById("time_start").value);
            if (!document.getElementById("names").value) {
                alert("请输入申请人！");
                return false
            } else if (!document.getElementById("department").value) {
                alert("请输入申请部门！");
                return false
            } else if (!document.getElementById("particulars").value) {
                alert("请输入会议事由！");
                return false
            } else if (!document.getElementById("time_start").value) {
                alert("请选择会议开始时间！");
                return false
            } else if (!document.getElementById("time_end").value) {
                alert("请选择会议结束时间！");
                return false
            } else if (!return_flag) {
                alert("结束时间不能小于开始时间！");
                return false
            } else if (!$('#meeting_root option:selected').val()) {
                alert("请请选择会议室！");
                return false
            } else if (!document.getElementById("Number_people").value) {
                alert("请输入参会人数！");
                return false
            }
            if (document.getElementById("time_start").value >= document.getElementById("time_end").value){
                alert("结束时间必须大于开始时间！");
                return false
            }
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/room_reservation.html", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("您的会议室申请提交成功！请注意审批状态！");
                            close_models();
                            window.location.href="room_reservation.html?insert=true";
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function contains(arrays, obj) {
            var i = arrays.length;
            while (i--) {
                if (arrays[i] === obj) {
                    return i;
                }
            }
            return false;
        }

        var name_list = {{ name_list | safe }};
        var attendee = document.getElementById("attendee");

        if (!name_list.length) {
            document.getElementById("meeting_reminder").style.display = "none";
            document.getElementById("no_meeting").style.display = "inline-block";
        }
        for (var H = 0; H < name_list.length; H++) {
            var p = document.createElement("p");
            p.style.textAlign = "left";
            p.style.width = "60px";
            p.style.display = "inline-block";
            p.innerHTML = name_list[H];
            attendee.appendChild(p);
        }


        function meet_online(tag_id) {
            document.getElementById(tag_id).style.display = "inline-block";
        }

        function meet_none(tag_id) {
            document.getElementById(tag_id).style.display = "none";
        }

        var search_date = '{{ search_date | safe }}';
        var dat = new Date(); //当前时间
        var nianD = dat.getFullYear();//当前年份
        var yueD = dat.getMonth(); //当前月
        var tianD = dat.getDate(); //当前天 这保存的年月日 是为了 当到达当前日期 有对比
        add(); //进入页面第一次渲染
        function add() {
            document.getElementById("date").innerHTML = "";
            var nian = dat.getFullYear();//当前年份
            var yue = dat.getMonth(); //当前月
            var tian = dat.getDate(); //当前天
            var arr = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"];
            document.getElementById('nian').innerText = nian;
            document.getElementById('yue').innerText = arr[yue];

            var setDat = new Date(nian, yue + 1, 1 - 1); //把时间设为下个月的1号 然后天数减去1 就可以得到 当前月的最后一天;
            var setTian = setDat.getDate(); //获取 当前月最后一天
            var setZhou = new Date(nian, yue, 1).getDay(); //获取当前月第一天 是 周几


            var last_dat = new Date(nian, yue, 1 - 1); //把时间设为本月的1号 然后天数减去1 就可以得到 当上个月的最后一天;
            var last_tian = last_dat.getDate(); //获取 前一月最后一天   30

            var first_col_data = create_last_month(setZhou, last_tian);
            var last_month_end_week = first_col_data[0];         // 日历第一行数据
            create_li(last_month_end_week, yue, nian, 'first');
            var col_last_date = first_col_data[1];

            for (var i = 0; i < 6; i++) {
                var same_week = create_same_month(col_last_date, setTian);          // 本周列表
                if (same_week.length === 1){
                    create_li(same_week[0], yue, nian, 'last');
                }else {
                    create_li(same_week[0], yue, nian);
                }
                if (same_week.length === 1) {
                    break
                }
                col_last_date = same_week[1];
            }
            if (search_date) {
                if (document.getElementById(search_date.slice(5, 10))) {
                    document.getElementById(search_date.slice(5, 10)).className='same_month active';
                }
            }
        }
        // 补充上月空缺日期
        function create_last_month(setZhou, last_tian) {
            // setZhou：当前月第一天是周几   例如：5
            // last_tian： 上个月最后一天的日期   例如：31
            var data_list = [];
            for (var t = setZhou - 1; t >= 0; t--) {
                var data_dict = {};
                data_dict["date"] = last_tian - t;
                data_dict["same_month"] = false;
                data_list.push(data_dict);
            }
            var last_day;
            if (data_list.length < 7) {
                for (var j = 1; j <= 7; j++) {
                    var data_dict1 = {};
                    data_dict1["date"] = j;
                    data_dict1["same_month"] = true;
                    data_list.push(data_dict1);
                    last_day = j;
                    if (data_list.length === 7) {
                        return [data_list, last_day]
                    }
                }
            }
        }

        // 创建本月日期
        function create_same_month(col_last_date, setTian) {
            // col_last_date：上周最后一天的日期      例如：14
            // setTian：当月最后一天的日期            例如：31
            var col_list = [];
            var same_week_last_day;
            for (var j = col_last_date + 1; j < 40; j++) {
                var data_dict = {};
                data_dict["date"] = j;
                data_dict["same_month"] = true;
                col_list.push(data_dict);
                same_week_last_day = j;
                if (col_list.length === 7) {
                    if (same_week_last_day === setTian) {
                        return [col_list]
                    }
                    return [col_list, same_week_last_day]
                }
                if (j >= setTian) {
                    for (var k = 1; k < 10; k++) {
                        var data_dict1 = {};
                        data_dict1["date"] = k;
                        data_dict1["same_month"] = false;
                        col_list.push(data_dict1);
                        if (col_list.length === 7) {
                            return [col_list]
                        }
                    }
                }
            }
        }

        document.getElementById("next").onclick = function () {
            dat.setMonth(dat.getMonth() + 1); //当点击下一个月时 对当前月进行加1;
            add(); //重新执行渲染 获取去 改变后的 年月日 进行渲染;
        };
        document.getElementById("prev").onclick = function () {
            dat.setMonth(dat.getMonth() - 1); //与下一月 同理
            add();
        };

        function create_li(date_list, yue, nian, first=false) {
            var div_date = document.getElementById("date");
            var ul = document.createElement("ul");
            ul.className = "ul_class";
            for (var i = 0; i < date_list.length; i++) {
                var li = document.createElement("li");li.style.height='35px';li.style.lineHeight='35px';
                li.innerText = date_list[i]["date"];li.id=standard_time(yue+1) + "-" + standard_time(date_list[i]["date"])
                if (first === "first" && date_list[i]["date"] > 20){
                    if (yue === 0) {
                        nian = nian-1;
                        yue = 12
                    }
                    li.id=standard_time(yue) + "-" + standard_time(date_list[i]["date"])
                    li.setAttribute("onclick", "create_schedule('" + nian + "-" + standard_time(yue) + "-" + standard_time(date_list[i]["date"]) + "')");
                }else if (first === "last" && date_list[i]["date"] < 8) {
                    if (yue === 11) {
                        nian = nian+1;
                        yue = -1;
                    }
                    li.id=standard_time(yue+2) + "-" + standard_time(date_list[i]["date"]);
                    li.setAttribute("onclick", "create_schedule('" + nian + "-" + standard_time(yue+2) + "-" + standard_time(date_list[i]["date"]) + "')");
                }else {
                    if (yue+1 === 13) {
                        var new_yue = "01"
                        var now_year = nian + 1
                    }else {
                        new_yue = standard_time(yue+1)
                        now_year = nian
                    }
                    li.id=new_yue + "-" + standard_time(date_list[i]["date"])
                    li.setAttribute("onclick", "create_schedule('" + now_year + "-" + new_yue + "-" + standard_time(date_list[i]["date"]) + "')");
                }

                if (date_list[i]["same_month"]) {
                    li.className = "same_month";
                    if (!search_date) {
                        if (date_list[i]["date"] === tianD && yue === yueD && nian === nianD) {
                            li.className = "same_month active";
                        }
                    }
                }
                //data-toggle="modal" data-target=".bd-example-modal-xl"
                ul.appendChild(li);
            }
            div_date.appendChild(ul);
        }
        // 更改标准时间格式
        function standard_time(standardT) {
            if (standardT < 10){
                standardT = "0"+standardT
            }
            return standardT
        }
        // 创建日程
        function create_schedule(schedule_date = false) {
            if (document.getElementsByClassName("same_month active").length){
                document.getElementsByClassName("same_month active")[0].className="same_month";
            }
            document.getElementById(schedule_date.slice(5, 10)).className='same_month active';

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/room_detail");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("search_time="+String(schedule_date));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate)
                        create_room(JsonDate["data"]);
                    }
                }
             }
        }

        function create_room(json_data) {
            var t_table = document.getElementById("t_table1")
            t_table.innerHTML = "";
            for (var i=0; i<json_data.length; i++) {
                var tr = document.createElement("tr");tr.style.height='42px';
                var td = document.createElement("td");var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");

                td.innerHTML = json_data[i]["data"]['time_duan'];td.style.textAlign="center";td.style.width='12%';
                tr.appendChild(td);
                if (json_data[i]["data"].hasOwnProperty("merge_0")) {
                    if (json_data[i]["data"]["merge_0"] !== 0) {
                        if (json_data[i]["data"]["status_0"] === '0'){
                            td1.innerHTML=json_data[i]["data"]["content_0"];td1.style.paddingLeft='10px';td1.style.background="#808080";td1.style.color="#F5F5F5";td1.rowSpan=json_data[i]["data"]["merge_0"];
                        }else if (json_data[i]["data"]["status_0"] === '1') {
                            td1.innerHTML=json_data[i]["data"]["content_0"];td1.style.paddingLeft='10px';td1.style.background="#3CB371";td1.style.color="#F5F5F5";td1.rowSpan=json_data[i]["data"]["merge_0"];
                        }else {
                            td1.innerHTML=json_data[i]["data"]["content_0"];td1.style.paddingLeft='10px';td1.style.background="#87CEEB";td1.style.color="#F5F5F5";td1.rowSpan=json_data[i]["data"]["merge_0"];
                        }
                    }else {
                        td1.innerHTML=''
                    }
                    tr.appendChild(td1);
                }

                if (json_data[i]["data"].hasOwnProperty("merge_1")) {
                    if (json_data[i]["data"]["merge_1"] !== 0) {
                        if (json_data[i]["data"]["status_1"] === '0'){
                            td2.innerHTML=json_data[i]["data"]["content_1"];td2.style.paddingLeft='10px';td2.style.background="#808080";td2.style.color="#F5F5F5";td2.rowSpan=json_data[i]["data"]["merge_1"];
                        }else if (json_data[i]["data"]["status_1"] === '1') {
                            td2.innerHTML=json_data[i]["data"]["content_1"];td2.style.paddingLeft='10px';td2.style.background="#3CB371";td2.style.color="#F5F5F5";td2.rowSpan=json_data[i]["data"]["merge_1"];
                        }else {
                            td2.innerHTML=json_data[i]["data"]["content_1"];td2.style.paddingLeft='10px';td2.style.background="#87CEEB";td2.style.color="#F5F5F5";td2.rowSpan=json_data[i]["data"]["merge_1"];
                        }
                    }else {
                        td2.innerHTML=''
                    }
                    tr.appendChild(td2);
                }

                if (json_data[i]["data"].hasOwnProperty("merge_2")) {
                    if (json_data[i]["data"]["merge_2"] !== 0) {
                        if (json_data[i]["data"]["status_2"] === '0'){
                            td3.innerHTML=json_data[i]["data"]["content_2"];td3.style.paddingLeft='10px';td3.style.background="#808080";td3.style.color="#F5F5F5";td3.rowSpan=json_data[i]["data"]["merge_2"];
                        }else if (json_data[i]["data"]["status_2"] === '1') {
                            td3.innerHTML=json_data[i]["data"]["content_2"];td3.style.paddingLeft='10px';td3.style.background="#3CB371";td3.style.color="#F5F5F5";td3.rowSpan=json_data[i]["data"]["merge_2"];
                        }else {
                            td3.innerHTML=json_data[i]["data"]["content_2"];td3.style.paddingLeft='10px';td3.style.background="#87CEEB";td3.style.color="#F5F5F5";td3.rowSpan=json_data[i]["data"]["merge_2"];
                        }
                    }else {
                        td3.innerHTML=''
                    }
                    tr.appendChild(td3);
                }

                if (json_data[i]["data"].hasOwnProperty("merge_3")) {
                    if (json_data[i]["data"]["merge_3"] !== 0) {
                        if (json_data[i]["data"]["status_3"] === '0'){
                            td4.innerHTML=json_data[i]["data"]["content_3"];td4.style.paddingLeft='10px';td4.style.background="#808080";td4.style.color="#F5F5F5";td4.rowSpan=json_data[i]["data"]["merge_3"];
                        }else if (json_data[i]["data"]["status_3"] === '1') {
                            td4.innerHTML=json_data[i]["data"]["content_3"];td4.style.paddingLeft='10px';td4.style.background="#3CB371";td4.style.color="#F5F5F5";td4.rowSpan=json_data[i]["data"]["merge_3"];
                        }else {
                            td4.innerHTML=json_data[i]["data"]["content_3"];td4.style.paddingLeft='10px';td4.style.background="#87CEEB";td4.style.color="#F5F5F5";td4.rowSpan=json_data[i]["data"]["merge_3"];
                        }
                    }else {
                        td4.innerHTML=''
                    }
                    tr.appendChild(td4);
                }

                t_table.appendChild(tr);
            }
        }

        function scrollConversationScreen() {
            $('#selected-div').scrollTop($('#selected-div')[0].scrollHeight);
        }

        function IdentifyPersonnel() {
            var prople_list = [];
            var selected_personnel_list = document.getElementsByClassName('selected-personnel');
            for (var i=0; i<selected_personnel_list.length; i++) {
                prople_list.push(selected_personnel_list[i].innerText)
            }
            document.getElementById("conferee").value = prople_list.join();
            close_model()
        }

        function onclick_upload_file() {
            document.getElementById("regular_main_body").click();
        }

        function upload_accessory1(file_type, tbody_id, accessory_type, bh_id) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', uuid);
            form.append('source', "hys");

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 400) {
                            alert("请上传xlsx格式文件！")
                        }
                        creat_table1(JsonDate, tbody_id)
                    }
                }
            };
        }

        function creat_table1(JsonData) {
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var html_str = `
                        <div style="width: 100%;height: 40px;line-height: 40px;">
                            <div style="width: 79%;height: 100%;display: inline-block;vertical-align: top;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                                <a target='_blank' id="Receipt" href="`+JsonData["pdf_path"][i]["pdf_path"]+`">`+JsonData["file_name"]+`</a>
                            </div>
                            <div onclick="RemoveTr(this, '`+JsonData["pdf_path"][i]["id"]+`')" style="width: 18%;height: 100%;display: inline-block;vertical-align: top;text-align: center;font-size: 12px;cursor: pointer;color: red;">
                                删除
                            </div>
                        </div>
                    `
                    $("#upload_file_list").append(html_str)
                }
            } else {
                html_str = `
                    <div style="width: 100%;height: 40px;line-height: 40px;">
                        <div style="width: 79%;height: 100%;display: inline-block;vertical-align: top;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                            <a target='_blank' id="Receipt" href="`+JsonData["pdf_path"]+`">`+JsonData["file_name"]+`</a>
                        </div>
                        <div onclick="RemoveTr(this, '`+JsonData["id"]+`')" style="width: 18%;height: 100%;display: inline-block;vertical-align: top;text-align: center;font-size: 12px;cursor: pointer;color: red;">
                            删除
                        </div>
                    </div>
                `
                $("#upload_file_list").append(html_str)
            }
        }

        function SignInCode(code_flag) {
            if (code_flag === 1) {
                document.getElementById("sign_in_code_1").checked=true;
                document.getElementById("sign_in_code_2").checked=false;
                document.getElementById("PersonnelList").style.display="block";
            }else {
                document.getElementById("sign_in_code_2").checked=true;
                document.getElementById("sign_in_code_1").checked=false;
                document.getElementById("PersonnelList").style.display="none";
            }
        }

        function UploadPersonnelList() {
            var files = document.getElementById("party_main_body").files[0];
            document.getElementById("file_names").innerText = files.name;
        }

        function RemoveTr(_this, tbody_id) {
            var trNode = $(_this).parent().parent();
            trNode.remove();

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(tbody_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }
    </script>
{% endblock %}